package com.chen.util;

import jakarta.servlet.*;

import java.io.IOException;

public class MyFilter1 implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("init---filter1");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("doFilter1---开始执行");
        //调取对应的servlet,或者调取下一个filter
        filterChain.doFilter(servletRequest, servletResponse);
        System.out.println("doFilter1---结束执行");
    }

    @Override
    public void destroy() {
        System.out.println("destroy---filter1");
    }
}
